<template>
    <Form ref="formData" :model="formData" :rules="ruleValidate" :label-width="80">
        <FormItem label="用户名" prop="userName">
            <Input v-model="formData.userName" ></Input>
        </FormItem>
        <FormItem label="昵称" prop="realName">
            <Input v-model="formData.realName" ></Input>
        </FormItem>
        <FormItem label="年龄" prop="age">
            <Input v-model="formData.age" type="number"></Input>
        </FormItem>
        <FormItem label="密码" prop="password">
            <Input v-model="formData.password" ></Input>
        </FormItem>
        <FormItem label="个性签名" prop="autograph">
            <Input v-model="formData.autograph" ></Input>
        </FormItem>
        <FormItem label="电话号码" prop="mobilePhone">
            <Input v-model="formData.mobilePhone" ></Input>
        </FormItem>
        <FormItem label="家庭住址" prop="address">
            <Input v-model="formData.address" ></Input>
        </FormItem>
        <div style="text-align: center;margin: 15px">
            <Button @click="handleReset('formData')">重置</Button>
            <Button type="primary" @click="handleSubmit('formData')" style="margin-left: 8px">保存</Button>
        </div>
        <!--加载中显示 -->
        <Spin size="large" fix v-if="spinShow"></Spin>
    </Form>
</template>

<script>
    import Base from '@/components/table/BaseEdit.vue';
    export default {
        extends:Base,
        data () {
            return {
                ruleValidate: {
                    userName: [
                        { required: true, message: '请输入用户名!', trigger: 'blur' },
                    ],
                    realName:[
                        { required: true, message: '请输入昵称!', trigger: 'blur' }
                    ],
                    password:[
                        { required: true, message: '请输入密码!', trigger: 'blur' }
                    ]
                }
            }
        },
        methods: {
            loadDataById(id){
                if(id!=null){
                    this.load("/api/system/user/read",{id})
                }
            },handleSubmit (name) {
                this.save(name,"/api/system/user/save");
            }
        }
    }
</script>

<style scoped>

</style>
